{% extends "adibilisadminBundle::layout.html.twig" %}
 
{% block title %}
  Listes des pages - {{ parent() }}
{% endblock %}

{% block adibilisadmin_body %}

{% if app.session.hasFlash('info') %}
        <div class="alert alert-success">
            {{ app.session.flash('info') }}
        </div>
{% endif %}


<h1>Pages</h1>

<table id="table_pages" class="table table-bordered">
    <thead>
        <tr>
            <th>Id</th>
            <th>Titre</th>
            <th>Actions</th>
        </tr>
    </thead>
    <tbody>
    {% for entity in entities %}
        <tr>
            <td><a href="{{ path('page_show', { 'slug': entity.slug }) }}">{{ entity.id }}</a></td>
            <td>{{ entity.title }}</td>
            <td>
                <ul>
                    <li>
                        <a href="{{ path('page_show', { 'slug': entity.slug }) }}">afficher</a>
                    </li>
                    {% if is_granted('ROLE_ADMIN') %}
                    <li>
                        <a href="{{ path('page_edit', { 'id': entity.id }) }}">modifier</a>
                    </li>
                    {% endif %}
                </ul>
            </td>
        </tr>
    {% endfor %}
    </tbody>
</table>

{% if is_granted('ROLE_ADMIN') %}
</br>
</br>
<a href="{{ path('page_new') }}" class="btn">
      <i class="icon-plus"></i>
      Ajouter une page
    </a>
{% endif %}

{% endblock %}